Skip to content

Add Chakra Admin UI and AWS Cost Dashboard#22

Merged
sboh1214 merged 27 commits into
mainfrom
feat/admin-chakra-aws
May 13, 2026
Merged

Add Chakra Admin UI and AWS Cost Dashboard#22
sboh1214 merged 27 commits into
mainfrom
feat/admin-chakra-aws

Conversation

@sboh1214
Copy link
Copy Markdown
Contributor

요약

  • 공용 Footer에 작은 관리자 링크를 추가했습니다.
  • CMS 관리자 화면과 로그인 화면을 Chakra UI 기반 레이아웃으로 개편하고, 햄버거 메뉴/좌측 관리자 메뉴/Drawer 기반 생성·수정/AlertDialog 기반 삭제 흐름을 적용했습니다.
  • AdminSettings Key-Value 테이블과 관리 화면을 추가하고, 저장된 AWS 자격 증명으로 Organizations/계정/당월·전월 비용을 확인하는 대시보드를 추가했습니다.

보안 및 구현 메모

  • AdminSettings의 실제 값은 서버에서만 읽고, 클라이언트 설정 UI에는 hasValuevalueLength 같은 비밀이 아닌 요약 정보만 전달합니다.
  • AWS Access Key/Secret Key는 AdminSettings에 저장하며, 비용 조회는 Cost Explorer 권장 리전인 us-east-1에서 수행합니다.
  • .sisyphus/는 git/prettier 대상에서 제외했습니다.

검증

  • LSP diagnostics: 최신 변경 파일 기준 오류 없음
  • pnpm build 통과
  • pnpm test 통과 (50 files / 650 tests)
  • pnpm lint 통과
  • pnpm prettier:check 통과
  • Oracle 최종 검증: <promise>VERIFIED</promise>

sboh1214 and others added 9 commits May 13, 2026 01:29
- Add Chakra UI provider and Toaster to (cms) route group.
- Introduce AdminShell with fixed left sidebar on desktop and slide-in Drawer on mobile.
- Move admin pages under (cms)/admin/(shell) so sign-in stays outside the shell.
- Replace the monolithic dashboard with a Chakra-styled overview that links to per-entity pages.
- Refactor sign-in page with Chakra Card and loading state.
- Remove obsolete dashboard, section, action-buttons, and inline style files.
- Add shared FormDrawer (right-side, with toast feedback) and DeleteAlertDialog.
- Add reusable EntityList that renders rows with edit/delete and mounts the per-entity drawer.
- Split the admin into per-entity routes under (shell): businesses, images, files, institutions, markdowns, webpages, reports, histories.
- Drop the old monolithic dashboard page tests and update sign-in/layout tests for the new UI.
- Add create/update/delete server actions for AdminSettings.
- Add /admin/settings page that lists settings and edits them via Drawer + AlertDialog.
- Mask the stored value in the list view; key is immutable when editing.
- Install @aws-sdk/client-organizations and @aws-sdk/client-cost-explorer.
- Add src/utils/aws.ts with describeOrganization, listAllAccounts (paginated), and getCurrentAndPreviousMonthCosts that buckets UnblendedCost by LINKED_ACCOUNT.
- Cost Explorer client is pinned to us-east-1 (only region that serves the CE endpoint).
- Add unit tests using aws-sdk-client-mock for both clients.
- New /admin/aws page that loads Organization, Accounts, and current/previous month UnblendedCost grouped by LINKED_ACCOUNT using credentials stored in AdminSettings.
- Highlights the management (main) account and shows per-account current/previous month totals plus organization-wide totals.
- Shows a warning with a settings link when AWS_ACCESS_KEY_ID / AWS_SECRET_ACCESS_KEY are not configured, and surfaces SDK errors via an alert.
- Drop stale 'use server' from src/utils/admin-settings.ts so we can co-locate constants with helpers.
- Fix Field.HelperText typo on the AdminSettings form.
- Apply Prettier formatting across touched files.
- Add .prettierignore and .gitignore entry for .sisyphus/ so prettier:check stays green.
- AdminSettings edit drawer no longer ships the stored secret to the browser; value stays blank and is only updated when the admin supplies a new value (matching update action now skips when value is empty).
- Replace the dashboard StatCard inline-styled Next Link with Chakra LinkBox/LinkOverlay.
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
@sboh1214 sboh1214 self-assigned this May 12, 2026
@sboh1214 sboh1214 added enhancement New feature or request design labels May 12, 2026
sboh1214 and others added 7 commits May 13, 2026 10:59
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
@codecov
Copy link
Copy Markdown

codecov Bot commented May 13, 2026

Codecov Report

❌ Patch coverage is 99.63542% with 7 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/app/(cms)/admin/(shell)/aws/page.tsx 98.48% 3 Missing ⚠️
...onents/admin/entity-forms/business-list-client.tsx 95.12% 2 Missing ⚠️
src/utils/admin-form.ts 33.33% 2 Missing ⚠️

Impacted file tree graph

@@            Coverage Diff            @@
##             main      #22     +/-   ##
=========================================
  Coverage   99.43%   99.44%             
=========================================
  Files          54       87     +33     
  Lines        2676     3985   +1309     
  Branches      323      700    +377     
=========================================
+ Hits         2661     3963   +1302     
- Misses         15       22      +7     
Flag Coverage Δ
unittests 99.44% <99.63%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
src/app/(cms)/admin/(shell)/businesses/page.tsx 100.00% <100.00%> (ø)
src/app/(cms)/admin/(shell)/files/page.tsx 100.00% <100.00%> (ø)
src/app/(cms)/admin/(shell)/histories/page.tsx 100.00% <100.00%> (ø)
src/app/(cms)/admin/(shell)/images/page.tsx 100.00% <100.00%> (ø)
src/app/(cms)/admin/(shell)/institutions/page.tsx 100.00% <100.00%> (ø)
src/app/(cms)/admin/(shell)/markdowns/page.tsx 100.00% <100.00%> (ø)
src/app/(cms)/admin/(shell)/page.tsx 100.00% <100.00%> (ø)
src/app/(cms)/admin/(shell)/reports/page.tsx 100.00% <100.00%> (ø)
src/app/(cms)/admin/(shell)/settings/page.tsx 100.00% <100.00%> (ø)
src/app/(cms)/admin/(shell)/webpages/page.tsx 100.00% <100.00%> (ø)
... and 33 more

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 0065e4c...e3fc812. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@sboh1214
Copy link
Copy Markdown
Contributor Author

최종 검증 상태를 공유합니다.

  • pnpm test:ci 통과: 696개 테스트 성공
  • Coverage threshold 통과: Lines/Statements 99.39%, Branches 95.68%, Functions 97.62%
  • pnpm build 통과
  • pnpm lint 통과
  • pnpm prettier:check 통과
  • LSP diagnostics(src) 에러 0건 확인

Admin Chakra UI 전환, AWS 대시보드, AdminSettings 보안 보완, 리팩터링 및 테스트 보강까지 완료되어 리뷰 가능한 상태입니다.

@sboh1214
Copy link
Copy Markdown
Contributor Author

@codex review

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c4acf573e3

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/utils/aws.ts Outdated
Comment thread src/app/(cms)/admin/(shell)/aws/page.tsx Outdated
sboh1214 and others added 2 commits May 13, 2026 11:22
GetCostAndUsage returns NextPageToken when groups span multiple pages.
Previously only the first page was read, so accounts in later pages were
silently dropped and monthly totals were undercounted in organizations
with many linked accounts. Loop until NextPageToken is exhausted.

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
AWS Organizations is retiring the Account.Status field on September 9, 2026.
Both Status and State coexist during the transition window, so render State
when present and fall back to Status; once Status is removed, accounts that
only return State will continue to display correctly.

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
@sboh1214
Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector
Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Already looking forward to the next diff.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

sboh1214 and others added 3 commits May 13, 2026 13:08
Next.js 16 defaults next dev/build to Turbopack, but Chakra UI v3 emits
emotion global styles (<style data-emotion="css-global">) whose
positioning diverges from the client tree after revalidatePath. The
mismatch caused all admin Drawer/Button handlers to stop responding
until a full page refresh. Follow Chakra's official guidance and opt
back into webpack until Next.js fixes the Turbopack emotion handling.

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Chakra v3 Drawer relies on an open: true \u2192 false transition to clean up
pointer blocking, focus trap, scroll lock, and aria-hidden state injected
when the drawer opens. Make the cleanup contract explicit by setting
lazyMount and unmountOnExit on Drawer.Root, and accept an optional
formKey prop so form fields can remount when the edit target changes.

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
sboh1214 and others added 6 commits May 13, 2026 13:42
The previous API conditionally rendered each list-client's Drawer with
{createOpen && ...} and hard-coded open={true}. Submitting a server
action set the parent state to false, which unmounted Drawer.Root while
its open prop was still true; Chakra never observed the close
transition, leaving an orphan backdrop and pointer-events:none on the
body so every subsequent click was blocked until full reload.

Pass open/setOpen to renderCreate and open/closeEdit plus the
preserved-during-close item to renderEdit. The 9 list-clients now wire
the FormDrawer to the actual open state, and EntityList tracks
lastEditing so the drawer keeps its data during the exit animation.

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
With Chakra Drawer's unmountOnExit, dialog/heading content stays in the
DOM during the close transition, so the synchronous queryByRole().not
assertion races the animation and flakes in jsdom. Wrap the post-close
assertions in waitFor so they wait for the transition to settle.

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
useState-during-render kept lastEditing in sync via a derived-state guard,
but the pattern fires extra renders whenever items.find returns a fresh
reference and is fragile under concurrent rendering. Capture the item
in the 수정 click handler instead, then resolve the rendered item as
editing ?? editingSnapshot so the drawer keeps its data during the
close animation without writing state during render.

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
FormDrawer accepts an optional formKey but no entity-form was passing
it, so re-opening the edit drawer with a different item while the
previous exit animation was still in flight could show stale
defaultValue fields. Pass the entity id (or 'create' for the create
drawer) so the <form> remounts when the edit target changes.

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Add two regression cases for the Chakra Drawer cleanup fix:
- after closing the create drawer the 추가 button stays clickable, so a
  second open succeeds without a page refresh
- closing one row's edit drawer and clicking 수정 on another row swaps
  the form title (and therefore its remounted defaultValue fields)

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
… swap

Tighten the regression coverage around the original Chakra Drawer bug:
- add a submit-then-revalidate-then-reopen case that exercises the exact
  FormDrawer.submit -> onOpenChange(false) -> parent rerender with new
  items path (not just the cancel-then-reopen path already covered)
- assert that switching edit targets swaps the 키 input's rendered
  defaultValue, proving the formKey remount actually takes effect

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
@sboh1214
Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector
Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Nice work!

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@sboh1214 sboh1214 merged commit 8c632d4 into main May 13, 2026
7 checks passed
@sboh1214 sboh1214 deleted the feat/admin-chakra-aws branch May 13, 2026 05:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

design enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant